#!/usr/bin/env python
# -*- coding:utf-8 -*-
from flask import jsonify
from flask_restful import Resource, reqparse

from service.pptGenService import PptGenService
from utils import commons


class PptGenOtherResource(Resource):
    @classmethod
    def ppt_generation_with_basic_structure(cls):
        """
        生成PPT

        """
        parser = reqparse.RequestParser()
        parser.add_argument('ppt_id', location='form', required=True, help='ppt_id参数类型不正确或缺失')
        parser.add_argument('template_id', location='form', required=True, help='template_id参数类型不正确或缺失')

        kwargs = parser.parse_args()
        kwargs = commons.put_remove_none(**kwargs)

        res = PptGenService.generate_ppt_with_basic_structure(**kwargs)
        return jsonify(code=res['code'], message=res['message'], data=res['data'])